package com.qiangesoft.bootcodegen.constant;

import com.qiangesoft.bootcodegen.utils.KvVO;

import java.util.ArrayList;
import java.util.List;

/**
 * 查询方式枚举
 *
 * @author qiangesoft
 * @date 2024-03-15
 */
public enum QueryType {

    EQ("eq", "="),

    GE("ge", ">="),

    LE("le", "<="),

    GT("gt", ">"),

    LT("lt", "<"),

    LIKE("like", "like"),

    LIKE_LEFT("likeLeft", "likeLeft"),

    LIKE_RIGHT("likeRight", "likeRight"),

    NE("ne", "!="),

    BETWEEN("between", "between"),

    IN("in", "in"),
    ;

    private final String key;

    private final String value;

    QueryType(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    public static List<KvVO> getValues() {
        List<KvVO> voList = new ArrayList<>();
        for (QueryType value : values()) {
            KvVO kv = new KvVO();
            kv.setKey(value.getKey());
            kv.setValue(value.getValue());
            voList.add(kv);
        }
        return voList;
    }
}